package com.project.bean;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;

public class ProjectBean {
    private int id;
    private String name;
    private String customer;
    private int font;
    private String state = "开发中";
    private LocalDate startDate = LocalDate.now();
    private LocalDate dueDate;
    /**交付剩余天数*/
    private String ramainDay;
    /**项目人数*/
    private int employeeNum;
    /**项目的人员*/
    private List<LinkBean> personOfProject;

    public ProjectBean() {
    }

    public ProjectBean(String name, String customer, int font, LocalDate dueDate) {
        this.name = name;
        this.customer = customer;
        this.font = font;
        this.dueDate = dueDate;
        this.ramainDay = getRamainDay();
    }


    public String getRamainDay() {
        if(dueDate == null){
            return null;
        }
        if("开发中".equals(state)){
            long x = ChronoUnit.DAYS.between(LocalDate.now(), dueDate);
            return x + "";
        }
        return "已交付";
    }

    public List<LinkBean> getPersonOfProject() {
        return personOfProject;
    }

    public void setPersonOfProject(List<LinkBean> personOfProject) {
        this.personOfProject = personOfProject;
    }

    public int getEmployeeNum() {
        return employeeNum;
    }

    public void setEmployeeNum(int employeeNum) {
        this.employeeNum = employeeNum;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCustomer() {
        return customer;
    }

    public void setCustomer(String customer) {
        this.customer = customer;
    }

    public int getFont() {
        return font;
    }

    public void setFont(int font) {
        this.font = font;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public LocalDate getDueDate() {
        return dueDate;
    }

    public void setDueDate(LocalDate dueDate) {
        this.dueDate = dueDate;
    }

    @Override
    public String toString() {
        return "ProjectBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", customer='" + customer + '\'' +
                ", font=" + font +
                ", state='" + state + '\'' +
                ", startDate=" + startDate +
                ", dueDate=" + dueDate +
                ", ramainDay='" + this.getRamainDay() + '\'' +
                ", employeeNum=" + employeeNum +
                ", personOfProject=" + personOfProject +
                '}' + "\n";
    }
}
